package com.bwie.controller;


import com.bwie.domain.Student;
import com.bwie.service.StuService;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.ArrayList;

/**
 * @Author: lrz
 * @Date: 2024/11/4 09:02
 * @Description:
 **/
@RestController
@RequestMapping("/stu/stu")
public class StuController {

    @Autowired
    StuService stuService;

    @PostMapping("/list")
    public R list(@RequestBody PageInfoVo pageInfoVo){
        return stuService.list(pageInfoVo);
    }


    @PostMapping("/addStudent")
    public R addStudent(@RequestBody Student student){
        return stuService.addStudent(student);
    }

    @PostMapping("/classList")
    public R classList(){
        return stuService.classList();
    }

    @PostMapping("/updateStudent")
    public R updateStudent(@RequestBody Student student){
        return stuService.updateStudent(student);
    }

    @PostMapping("/listClass")
    public R listClass(@RequestBody PageInfoVo pageInfoVo){
        return stuService.listClass(pageInfoVo);
    }

    //上传图片
    @PostMapping("/c")
    public R shmsg(@RequestPart("file")MultipartFile file) throws IOException {
        return stuService.shmsg(file);
    }

    @PostMapping("/plDelete")
    public R plDelete(@RequestBody ArrayList<Integer> ids){
        return stuService.plDelete(ids);
    }

    @PostMapping("/shopList")
    public R shopList(){
        return stuService.shopList();
    }


}
